﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Windows.Threading;
using ScrumTable.BL.DM.DataManagement;
using Microsoft.Practices.Unity;
using ScrumTable.Config.ElementManagement;
using ScrumTable.UI.ViewModel.Data;

#endregion

namespace ScrumTable.UI.ViewModel.Tools
{
    /// <summary>
    /// View Model for a simple menu
    /// </summary>
    public class ViewModelReportSelector : ViewModelBase
    {

        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------
        private RelayCommand _selectReport;


        #endregion


        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------
        /// <summary>
        /// Occurs when a property value changes.
        /// </summary>
        public event EventHandler<ReportSelectEventArgs> ReportSelected;

        public RelayCommand SelectReportCommand
        {
            get
            {
                if (_selectReport == null)
                {
                    _selectReport = new RelayCommand(
                        param =>
                            {
                                if (ReportSelected != null)
                                {
                                    ReportSelected(this, new ReportSelectEventArgs() {Report = ((Report)param)});
                                }

                            },
                        param => (param as Report) != null
                        );
                }
                return _selectReport;
            }
        }
      
        public List<Uri> ReportList
        {
            get { return (from x in  ScrumData.CurrentProject.Reports select x.FullPath).ToList(); }
        }

        /// <summary>
        /// Gets or sets the ScrumViewModelData
        /// </summary>
        /// <value>ScrumViewModelData</value>
        [Dependency]
        public ScrumViewModelData ScrumData { get; set; }

        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        public ViewModelReportSelector()
        {
           
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

 
        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------
        
      

        #endregion

    }

    /// <summary>
    /// Contains the information of the selected report
    /// </summary>
    public class ReportSelectEventArgs : EventArgs
    {
        /// <summary>
        /// Name of the Selected Report
        /// </summary>
        public Report Report;
    }
}